/*
 * Triangle3D.cpp
 *
 *  Created on: 31.1.2013
 *      Author: Travis
 */

#ifdef _WIN32 
#include <windows.h> 
#endif

#include "Triangle3D.h"
namespace DataTypes
{

Triangle3D::Triangle3D(glm::vec3 a, glm::vec3 b, glm::vec3 c)
{
	A = a;
	B = b;
	C = c;
}

Triangle3D::Triangle3D()
{
}

Triangle3D::~Triangle3D()
{
}

glm::vec4 Triangle3D::NormalOfTriangle()
{
	glm::vec4 out;

	out.x = A.y * (B.z - C.z) + B.y * (C.z - A.z) + C.y * (A.z - B.z);
	out.y = A.z * (B.x - C.x) + B.z * (C.x - A.x) + C.z * (A.x - B.x);
	out.z = A.x * (B.y - C.y) + B.x * (C.y - A.y) + C.x * (A.y - B.y);
	out.w = -(A.x * (B.y * C.z - C.y * B.z) + B.x * (C.y * A.z - A.y * C.z)
			+ C.x * (A.y * B.z - B.y * A.z));

	return out;
}

//get
glm::vec3 Triangle3D::getA()
{
	return A;
}

glm::vec3 Triangle3D::getB()
{
	return B;
}

glm::vec3 Triangle3D::getC()
{
	return C;
}

//set
void Triangle3D::setA(glm::vec3 a)
{
	A = a;
}

void Triangle3D::setB(glm::vec3 b)
{
	B = b;
}

void Triangle3D::setC(glm::vec3 c)
{
	C = c;
}
}

